import datetime
from data_reader.DataReader import DataReader


class NSHReader(DataReader):
    header_lines = 11
    
    def __init__(self, data_dir):
        return DataReader.__init__(self, data_dir)


    def read_timestamp(self):
        time_str = self.timestamp_file_.readline()
        return float(time_str)/1e6

    def read_sweep(self):
        points = []

        f = open(self.data_dir_ + self.files_[self.index_], "r")
        for i in range(self.header_lines):
            f.readline()
        
        for line in f:
            arr = line.split(' ')
            x = float(arr[0])
            y = float(arr[1])
            z = float(arr[2])
            points.append((x, y, z))

        self.index_ += 1
        return points
